<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'workflowInstance.label', default: 'workflowInstance')}" />
    <title>资产工作流实例</title>
</head>

<body>

<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>新增资产工作流实例</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item"><a href="#!">新增资产工作流实例</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">
        <g:if test="${flash.message}">
            <ul class="errors" role="alert">
                <g:eachError bean="${flash.message}" var="error">
                    <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                        <g:message error="${error}"/>
                    </li>
                </g:eachError>
            </ul>
        </g:if>
        <g:hasErrors bean="${this.workflowInstance}">
            <ul class="errors" role="alert">
                <g:eachError bean="${this.workflowInstance}" var="error">
                    <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
                </g:eachError>
            </ul>
        </g:hasErrors>
        <!-- Hover table card start -->
        <g:form action="saveWorkflowInstanceOnAsset" class="form-horizontal">
        <div class="card">
                    <div class="card-header">
                        <h5>资产信息</h5>
                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">
                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">资产名称</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="asset.name" id="name" value="${this.workflowInstance?.asset?.name}" />
                                </div>
                                <label class="col-md-2 col-form-label is-required">序列号</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="asset.code" id="code" value="${this.workflowInstance?.asset?.code}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">资产状态</label>
                                <div class="col-md-3">
                                    <g:select class="form-control" name="asset.status" value="${this.workflowInstance?.asset?.status?.id}" id="status" optionValue="name" optionKey="id" from="${com.next.AssetStatus.list()}" noSelection="${['': '请选择']}" />
                                </div>

                                <label class="col-md-2 col-form-label is-required">产品</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="asset.product" value="${this.workflowInstance?.asset?.product?.id}" id="product" optionValue="name" optionKey="id" from="${com.next.Product.findAllByActive(true)}" noSelection="${['': '请选择']}" />
                                </div>

                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">客户</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="asset.account.id" value="${this.workflowInstance?.asset?.account?.id}" optionValue="account" optionKey="accountId" from="${com.next.AccountTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}" />
                                </div>
                                <label class="col-md-2 col-form-label">联系人</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="asset.contact.id" value="${this.workflowInstance?.asset?.contact?.id}" optionValue="contact" optionKey="contactId" from="${com.next.ContactTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}" />
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">合同</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="asset.contract.id" value="${this.workflowInstance?.asset?.contract?.id}" optionKey="id" from="${com.next.Contract.list()}" noSelection="${['': '请选择']}" />
                                </div>

                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">数量</label>

                                <div class="col-md-3">
                                    <g:field type="number" class="form-control" name="asset.quantity" id="quantity" value="${this.workflowInstance?.asset?.quantity}" />
                                </div>
                                <label class="col-md-2 col-form-label">采购时间</label>

                                <div class="col-md-3 datePicker">
                                    %{--
                                    <g:datePicker precision="day" name="purchaseDate" value="${this.asset?.purchaseDate}" /> --}%
                                    <div class="input-group ">
                                        <input type="text" valctrl="purchaseDate" value="${this.workflowInstance?.asset?.purchaseDate}" class="form-control form_date">
                                        <input type="hidden" id="purchaseDate" name="asset.purchaseDate" value="date.struct">
                                        <input type="hidden" id="purchaseDate_day" name="asset.purchaseDate_day" value="">
                                        <input type="hidden" id="purchaseDate_month" name="asset.purchaseDate_month" value="">
                                        <input type="hidden" id="purchaseDate_year" name="asset.purchaseDate_year" value="">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">安装时间</label>

                                <div class="col-md-3 datePicker">
                                    <div class="input-group ">
                                        <input type="text" valctrl="installDate" value="${this.workflowInstance?.asset?.installDate}" class="form-control form_date">
                                        <input type="hidden" id="installDate" name="asset.installDate" value="date.struct">
                                        <input type="hidden" id="installDate_day" name="asset.installDate_day" value="">
                                        <input type="hidden" id="installDate_month" name="asset.installDate_month" value="">
                                        <input type="hidden" id="installDate_year" name="asset.installDate_year" value="">
                                    </div>
                                </div>
                                <label class="col-md-2 col-form-label">停用时间</label>

                                <div class="col-md-3 datePicker">
                                    %{--
                                    <g:datePicker precision="day" name="usageEndDate" value="${this.asset?.usageEndDate}" /> --}%
                                    <div class="input-group ">
                                        <input type="text" valctrl="usageEndDate" value="${this.workflowInstance?.asset?.usageEndDate}" class="form-control form_date">
                                        <input type="hidden" id="usageEndDate" name="asset.usageEndDate" value="date.struct">
                                        <input type="hidden" id="usageEndDate_day" name="asset.usageEndDate_day" value="">
                                        <input type="hidden" id="usageEndDate_month" name="asset.usageEndDate_month" value="">
                                        <input type="hidden" id="usageEndDate_year" name="asset.usageEndDate_year" value="">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">竞争对手的设备</label>
                                <div class="col-md-3 border-checkbox-section">
                                    <div class="border-checkbox-group border-checkbox-group-primary form-control-static">
                                        <g:checkBox class="border-checkbox" name="asset.competitorAsset" id="checkbox0" value="${this.workflowInstance?.asset?.competitorAsset}" />
                                        <label class="border-checkbox-label" for="checkbox0"></label>
                                    </div>

                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">备注</label>

                                <div class="col-md-8">
                                    <g:textArea rows="3" class="form-control" name="asset.description" id="description" value="${this.workflowInstance?.asset?.description}" />
                                </div>

                            </div>

                    </div>
                </div>
            <div class="card">
                <div class="card-header">
                    <h5>工作流实例</h5>

                    <div class="card-header-right">

                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 control-label is-required">工作流</label>

                            <div class="col-md-3">
                                <g:textField class="hidden" name="project.id"
                                             value="${this.workflowInstance?.project?.id}"/>
                                <g:select  class="form-control" name="workflow.id" id="workflow"
                                           value="${this.workflowInstance?.workflow?.id}" from="${com.next.Workflow.findAllByActive(true)}"
                                           optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                            </div>
                            <label class="col-md-2 control-label is-required">名称</label>

                            <div class="col-md-3">

                                <g:textField class="form-control" name="name" value="${this.workflowInstance?.name}"/>

                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-md-12">
                                <g:submitButton class="btn btn-info" name="update" value="保存"/>
                            </div>
                        </div>
                    
                </div>
                <!-- Hover table card end -->
            </div>
</g:form>
            <!-- Page-body end -->
        </div>
    </div>
</div>

</body>

</html>
